<template>
  <div class="page" style="width: 100%;height: auto;background: #EBEDEF;">
    <!-- <div class="cartBox" > -->
    <div class="cartPosition">
      <indexMb v-if="cardData.type==2" :widthItem="widthItem" :data="cardData" :empId="empId" ref="indexMb" @goCartDetail="goCartDetailFun"></indexMb>
      <indexMb1  v-if="cardData.type==1" :widthItem="widthItem"  :data="cardData" :empId="empId" ref="indexMb1" @goCartDetail="goCartDetailFun"></indexMb1>
    </div>
      <div class="cartPosition">
    <div class="cartBox" v-if="!cardData.type">
      <p style="font-size: 38rpx;margin:20rpx 0 30rpx 0;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;"> 杭州市西湖区销帮网络技术有限公司</p>
      <div class="cart_top">
        <div class="cart_name">

          <p  style="font-family: 'KaiTi';color: #fff;font-weight: normal;margin-bottom:22rpx;margin-top:10rpx;">销帮客服</p>
          <p style="color: #fff;font-weight: normal;display: flex;justify-content: flex-start;align-items: center;box-sizing: border-box;padding-right: 24rpx;" >

            <span>电话:&nbsp;&nbsp;&nbsp;&nbsp;13116858811</span>
            <img style="width:23px;height:23px;color: #fff;margin-right:76rpx;" @click.stop="callPhone(data.mobile)" src="../../icons/svg/phone.svg"/>
<!--            <img src="../../../static/images/phone.png" alt="" style="width: 40rpx;height: 40rpx;margin-right: 12rpx;" @click.stop="callPhone('13116858811')">-->
          </p>

        </div>
        <!--        <img src="../../../static/images/user.png" alt="">-->
        <!--      上传图片-->
<!--        <div class="weui-uploader__bd" style="width:34%">-->
<!--          <ul class="weui-uploader__files" id="uploaderFiles">-->
<!--            <li class="weui-uploader__file weui-uploader__file_status"  >-->
<!--              123-->
<!--              &lt;!&ndash;            <div class="weui-uploader__file-content" @click="remove(index)">&ndash;&gt;-->
<!--              &lt;!&ndash;              <i class="weui-icon-warn"></i>&ndash;&gt;-->
<!--              &lt;!&ndash;            </div>&ndash;&gt;-->
<!--            </li>-->


<!--          </ul>-->

<!--        </div>-->
    </div>
    </div>
    </div>
    <div class="createOut active"  v-if="!cartId">


      <div class="create"  @click="createCard"> 立即创建我的名片</div>

      <template v-if="isSc">
        <div class="createShare"  v-if="btnStatus==0"  @click.stop="scFun">
          收藏名片
        </div>
        <div class="createShare"  v-if="btnStatus==2"  >
          已收藏
        </div>
      </template>

    </div>
    <div class="createOut active"  v-if="cartId">

      <div class="create"  @click="goCartDetail"> 进入我的名片</div>
      <div class="createShare" v-if="btnStatus==1">
        <button open-type="share" data-name="pageShare" id="share" @click="onShareAppMessage">
        发送名片
        </button>
      </div>
      <template v-if="isSc">
      <div class="createShare"  v-if="btnStatus==0"  @click.stop="scFun">
        收藏名片
      </div>
        <div class="createShare"  v-if="btnStatus==2"  >
         已收藏
        </div>
      </template>
      <!-- <span>立即创建</span> -->

    </div>
    <div class="conpanyDetail">
      <h2 class="title" style="margin-bottom: 20rpx;">公司名称【简介】</h2>

      <video
        class="video"
        id="myVideo"
        v-if="cardData.flag3&&cardData.flag3.indexOf('https')!=-1"
        :src="cardData.flag3"
        @play="bindplay"
        style="width: 100%;height: 250rpx;"></video>

      <p class="fontStyle">
        {{cardData.flag4}}
      </p>
    </div>
    <getCartDetail :isMeIndex="isMeIndex" v-if="isOpen" :cardId="0" :isLogin="1"></getCartDetail>
    <div class="tabs" style="margin-bottom: 20rpx;background: #fff">
      <h2  class="title">最新动态</h2>
      <template v-if="NewMaterial.length">


        <div class="listBox"  v-for="(item,index) in NewMaterial" :key="index">
          <img :src="item.avatarUrl" alt="">
          <div class="list_content">
            <div class="content_top">
              <div>
                <p style="font-size: 30rpx;color:#000">{{item.nickName}}</p>
                <p style="font-size: 30rpx;color:#D1D1D1">{{item.createTime}}</p>
              </div>
              <!--                  <van-button type="primary" size="small">联系TA</van-button>-->
            </div>

            <div class="content_midd" >

              <img :src="item.imgUrl" alt="" style="width:80%" mode="aspectFill" @click="handleImagePreview(item.imgUrl)">
              <p class="content_midd_title" >{{item.description}}</p>
            </div>

          </div>
        </div>
        <div class="weui-loadmore" @click="gewhoSctMore" v-if="iscurrPage>0" style="padding-bottom: 20rpx;">
          <span class="weui-loadmore__tips" style="color:#FFB90F">加载更多--剩余{{iscurrPage}}页</span>
        </div>

        <div class="weui-loadmore weui-loadmore_line" style="margin: 0 auto;" v-if="outData">
          <span class="weui-loadmore__tips">已经到底了</span>
        </div>


      </template>
      <template v-if="!NewMaterial.length">
        <p  style="text-align: center">
          暂无动态
        </p>
      </template>

    </div>
<!--    <div class="banner" :style="{marginTop:screenHeight*0.35+'rpx'}">-->
<!--    <swiper class="swiper"-->
<!--            :indicator-dots="indicatorDots"-->
<!--            :circular="circular"-->
<!--            :interval="interval"-->
<!--            :duration="duration"-->
<!--            :autoplay="autoplay">-->

<!--      <swiper-item >-->
<!--&lt;!&ndash;        <div @click="getDetail(item.id)"  class="bannerBox">&ndash;&gt;-->
<!--&lt;!&ndash;          <img :src="item.imgUrl" alt="">&ndash;&gt;-->
<!--&lt;!&ndash;          <p class="bannerTitle">{{item.description}}</p>&ndash;&gt;-->
<!--&lt;!&ndash;        </div>&ndash;&gt;-->
<!--      <div class="product">-->
<!--          <ul class="product_list">-->
<!--            <li @click="getDetail(detailListCopy[0].id)"  >-->
<!--              <div>-->
<!--                <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--                <img :src="detailListCopy[0]&&detailListCopy[0].imgUrl" alt="">-->
<!--              </div>-->

<!--              <p class="bannerTitle">{{detailListCopy[0]&&detailListCopy[0].description}}</p>-->
<!--            </li>-->
<!--            <li @click="getDetail(detailListCopy[1].id)"  >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--                  <img :src="detailListCopy[1]&&detailListCopy[1].imgUrl" alt="">-->
<!--              </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[1]&&detailListCopy[1].description}}</p>-->
<!--            </li>-->

<!--          </ul>-->
<!--        </div>-->
<!--      </swiper-item>-->
<!--    <swiper-item >-->
<!--        <div class="product">-->
<!--          <ul class="product_list">-->

<!--            <li @click="getDetail(detailListCopy[1].id)"  >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--               <img :src="detailListCopy[1]&&detailListCopy[1].imgUrl" alt="">-->
<!--            </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[1]&&detailListCopy[1].description}}</p>-->
<!--            </li>-->
<!--            <li @click="getDetail(detailListCopy[2].id)" >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--                  <img :src="detailListCopy[2]&&detailListCopy[2].imgUrl" alt="">-->
<!--              </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[2]&&detailListCopy[2].description}}</p>-->
<!--            </li>-->

<!--          </ul>-->
<!--        </div>-->
<!--      </swiper-item>-->
<!--      <swiper-item >-->
<!--        <div class="product">-->
<!--          <ul class="product_list">-->

<!--            <li @click="getDetail(detailListCopy[2].id)" >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--                <img :src="detailListCopy[2]&&detailListCopy[2].imgUrl" alt="">-->
<!--            </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[2]&&detailListCopy[2].description}}</p>-->
<!--            </li>-->
<!--            <li @click="getDetail(detailListCopy[3].id)" >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--              <img :src="detailListCopy[3]&&detailListCopy[3].imgUrl" alt="">-->
<!--            </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[3]&&detailListCopy[3].description}}</p>-->
<!--            </li>-->
<!--          </ul>-->
<!--        </div>-->
<!--      </swiper-item>-->
<!--      <swiper-item >-->
<!--        <div class="product">-->
<!--          <ul class="product_list">-->
<!--            <li @click="getDetail(detailListCopy[3].id)" >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--                 <img :src="detailListCopy[3]&&detailListCopy[3].imgUrl" alt="">-->
<!--              </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[3]&&detailListCopy[3].description}}</p>-->
<!--            </li>-->
<!--            <li @click="getDetail(detailListCopy[0].id)"  >-->
<!--              <div>-->
<!--                 <div>-->
<!--                  <span>点击查看产品详情</span>-->
<!--                </div>-->
<!--                <img :src="detailListCopy[0]&&detailListCopy[0].imgUrl" alt="">-->
<!--              </div>-->

<!--              <p class="bannerTitle" style="white-space: normal;text-overflow: ellipsis;overflow: hidden;">{{detailListCopy[0]&&detailListCopy[0].description}}</p>-->
<!--            </li>-->

<!--          </ul>-->
<!--        </div>-->
<!--      </swiper-item>-->

<!--    </swiper>-->
<!--    </div>-->
<!--    <van-notice-bar-->
<!--      v-if="!cartId"-->
<!--      class="fz"-->
<!--      backgroundColor="#fff"-->

<!--      text="创建名片后可以使用同功能，名片展示、商品信息展示。"-->
<!--    />-->
<!--    <van-notice-bar-->
<!--      v-if="cartId"-->
<!--      color="#1989FA"-->
<!--      backgroundColor="#fff"-->

<!--      :text="message"-->
<!--    />-->



<!--     <ul class="box" v-if="isOpen">-->
<!--       <li  @click="scFun" v-if="isSc">-->
<!--&lt;!&ndash;          <img src="../../../static/images/scOut.png" alt="" v-if="!scActive">&ndash;&gt;-->
<!--&lt;!&ndash;         <img src="../../../static/images/scIn.png" alt="" v-if="scActive">&ndash;&gt;-->
<!--          <p style="font-size: 28rpx;">收藏名片</p>-->
<!--&lt;!&ndash;         <p v-if="scActive">已收藏</p>&ndash;&gt;-->
<!--       </li>-->
<!--       <li v-if="isShare">-->
<!--          <button open-type="share" data-name="pageShare" id="share" @click="onShareAppMessage">-->
<!--         <img src="../../../static/images/share1.png" alt="">-->
<!--         <p>分享</p>-->
<!--         </button>-->
<!--       </li>-->
<!--     </ul>-->
     <!-- <shareBox :isOpen="isOpen" :isSc="isSc" :isShare="isShare"></shareBox> -->
       <getUserinfo ref="getUserinfo" @getBtnType="getBtnTypeFun" :isShow="isShow" :empId="empId" @changeDom="changeDomFun"></getUserinfo>

  </div>
<!--  </div>-->

</template>
<script>
 import {obj} from "../../utils/log.js"
import card from '@/components/card'
import dragSort from '../../components/drap'
import indexMb from '../../components/indexMb.vue'
import indexMb1 from '../../components/indexMb1.vue'
import getUserinfo from '../../components/getUserinfo'
import shareBox from "../../components/shareBox"
import getCartDetail from "../../components/getCartDetail.vue"
   import {getOptions} from "../../utils/api.js"
export default {
  data () {
    return {
      isActive: false,
      circular: true,
      indicatorDots: false,
      btnStatus:"",//按钮类型
      autoplay: true,
        scActive:false,//是否收藏
      interval: 2000,
        widthItem:'90%',
      message:"",
      isShow: false,
      iscurrPage:"",
      mbNumber: 1,
      duration: 500,
      cartId:"",
      NewMaterial:[],
      pageNumNew:1,
      pageSizeNew:6,
      cardData: {},
      isOpen:false,
        userId:"",
      isSc:false,
      isShare:false,
      isCart: false,
      name: '名字',
      loadMore:true,
      outData:false,
      cartId1:"",
      screenHeight:375,
      options:{},
      result:[],
      empId:"",//分享后回去父级id
      images: [],
        detailList: [{imgUrl: require('../../../static/images/cun.jpg'),defaultImg: require('../../../static/images/cun.jpg'), id: '',description:"春天",isClick:false,isEdit:false},
            {imgUrl: require('../../../static/images/xia.jpg'),defaultImg: require('../../../static/images/xia.jpg'), id: '',description:"夏天",isClick:false,isEdit:false},
            {imgUrl: require('../../../static/images/qiu.jpg'),defaultImg: require('../../../static/images/qiu.jpg'), id: '',description:"秋天",isClick:false,isEdit:false},
            {imgUrl: require('../../../static/images/dong.jpg'),defaultImg: require('../../../static/images/dong.jpg'), id: '',description:"冬天",isClick:false,isEdit:false}],
        detailListCopy:[]
    }
  },

  onShow (options) {
    let num = 0;
    let that=this;

    wx.getSystemInfo({
      success: function (res) {
        let clientHeight = res.windowHeight;
        let clientWidth = res.windowWidth;
        let ratio = 750 / clientWidth;
        that.screenHeight=clientHeight * ratio;
     //   console.log(that.screenHeight)
      }
    });
    // this.getDetailNose();
    // console.log(appId)


    wx.setNavigationBarTitle({
      title: '首页'
    })
      // this.getBanner()
    this.cartId=wx.getStorageSync('cartId')
    // this.getListDetail()
     this.cartId1=wx.getStorageSync('cartId1')
    let userInfo = wx.getStorageSync('userInfo')
      if(this.cartId){

          if(!this.empId){
              this.isShare=true;
          }

      }else{
          this.isShare=false;
      }
    if (userInfo) {



      this.isShow=false;

      // this.getindexCard()
    }else{

      this.images=this.detailList
    }
  },
  mounted () {

  },
  onPullDownRefresh(){
   // console.log('down')
   //  this.getBanner()
    if(!this.options.isCartId){
      this.getindexCard(wx.getStorageSync('cartId1'),'')
    }else{
      if(this.options.isCartId==1){
        this.getindexCard(  "", wx.getStorageSync('userId1'))
      }else if(this.options.isCartId==2){
        this.getindexCard(  wx.getStorageSync('cartId1'), wx.getStorageSync('userId1'))
      }

    }


  },
  components: {
    card,
    dragSort,
    indexMb,
    indexMb1,
    getUserinfo,
    shareBox,
    getCartDetail
  },
  onLoad (options) {
     // obj.info(options.scene)
     //console.log(options)
    if (options.scene) {//二维码
    obj.info(decodeURIComponent(options.scene))
    let scene=decodeURIComponent(options.scene)
   // console.log(scene)
       let str=scene.split('&');

       obj.info(JSON.stringify(str))
      wx.setStorageSync('cartId1', str[0])

      wx.setStorageSync('userId1',  str[1])
      this.options={
        cartId: str[0],
        userId:str[1],
        isCartId:str[2]
      }
       console.log(this.options.userId)
    }else{
      this.options=options;
      wx.setStorageSync('cartId1', options.cartId)

      wx.setStorageSync('userId1', options.userId)
    }
    // isCartId

    if(wx.getStorageSync('cartId1')&&wx.getStorageSync('userId1')!=wx.getStorageSync('userId')){//从分享点击进去
   //   console.log(options)
       this.empId=this.options.userId;

     //  console.log(this.empId)
      console.log('分享')
       this.getToken(this.options.userId,this.options)

    }else {//自己点进去
      //console.log('不是分享')
        this.ownInt()
    }
  },
  // 分享
  onShareAppMessage () {

   let shareData= JSON.parse(wx.getStorageSync('shareData'))
   // let Authorization= wx.getStorageSync('Authorization')
      let shareType=wx.getStorageSync('shareType')
    let cartId=wx.getStorageSync('cartId')
    let userId= wx.getStorageSync('userId')
      let shareUrl=wx.getStorageSync('shareUrl')
    let that = this;


       return {
           title:`您好,我是${shareData.company}的${shareData.name},请惠存`, // 转发后 所显示的title
           path: `/pages/index/main?cartId=${cartId}&userId=${userId}&img=${shareData.logo}&isCartId=2`, // 相对的路径
           imageUrl:shareData.logo,
           success: (res) => { // 成功后要做的事情
               //console.log(res.shareTickets[0])
               // console.log

               wx.getShareInfo({
                   shareTicket: res.shareTickets[0],
                   success: (res) => {
                       //console.log(res)
                       //console.log(that.setData.isShow)
                   },
                   fail: function (res) {
                      // console.log(res)
                   },
                   complete: function (res) {
                     //  console.log(res)
                   }
               })
           },
           fail: function (res) {
               // 分享失败
              // console.log('分享失败' + res)
           }
       }


  },
  methods: {
    handleImagePreview (img) { // 预览图片
      let imgs= this.NewMaterial;
      let imgUrl=imgs.map((item)=>{
        return item.imgUrl
      });
      let index=0;
      imgUrl.forEach((a,i)=>{
        if(a==img){
          index=i;
        }
      })
      // console.log(index)

      // const images = [this.dataObj.imgUrl]
      // let arr = []
      // this.images.forEach((a, i) => {
      //   arr.push(a.imgUrl)
      // })
      // console.log(images)
      wx.previewImage({
        current: imgUrl[index], // 当前预览的图片
        urls: imgUrl // 所有要预览的图片
      })
    },
    gewhoSctMore(){
      this.loadMore=false;
      this.pageNumNew++;
      this.getNewMaterial();
    },
    getNewMaterial(){//最新动态
      // this.NewMaterial=[];
      this.$http.request({
        method: 'post',
        url: `/api/material/getNewMaterialByCardId`,
        body: {
          "cardId": wx.getStorageSync('cartId1'),
          "pageNum": this.pageNumNew,
          "pageSize": this.pageSizeNew
        }
      }).then((data)=>{
        if (data.code == 200) {
          this.result=data.data.list;
          this.userInfo=wx.getStorageSync("userInfo")&&JSON.parse(JSON.parse(wx.getStorageSync("userInfo")));
          this.iscurrPage=data.data.totalPage-data.data.currPage;
          if (this.pageNumNew == 1) {
            this.NewMaterial=data.data.list;
            if(this.result.length<6){
              this.loadMore=false;
              this.outData=true;
            }
            else{

              this.loadMore=true;
              this.outData=false;
            }
            // console.log( this.NewMaterial)
          }else{
            let isAdd=false;
           // console.log(this.NewMaterial)
           this.NewMaterial.forEach((a,i)=>{
              let arr=data.data.list[0]
                if(a.id==arr.id){
                  isAdd=false;
                }else{
                   isAdd=true;
                }

            })
            if(isAdd){
               this.NewMaterial.push(...data.data.list);
            }


            if(this.result.length<6){

             this.loadMore=false;
               this.outData=true;
             } else{
               this.outData=false;
               this.loadMore=true;
            }
          }
          console.log( this.NewMaterial)
          this.NewMaterial.forEach((a,i)=>{
            a.avatarUrl=this.cardData.logo;
            a.nickName=this.cardData.name;
          })
        }
      })
    },
    bindplay(e){
      this.videoContext = wx.createVideoContext('myVideo',this);
      this.videoContext.requestFullScreen({ direction: 0 });
    },
    getBtnTypeFun(type){

     this.btnStatus=type;
     // if(this.empId){
        this.isSc=true;
        this.isShare=false;

          this.cartId=wx.getStorageSync('cartId')
          // wx.showToast({
          //   title:this.cartId ,
          //   icon: 'none',
          //   duration:10000
          //
          // })

        this.$forceUpdate()


     // }else{
     //    this.isSc=false;
     //    this.isShare=true;
     // }
    },
    callPhone(phone){
      wx.makePhoneCall({
        phoneNumber: phone //仅为示例，并非真实的电话号码
      })
    },
    getcardForward(){//添加浏览记录
      let cartId=wx.getStorageSync('cartId1')
      let userId=wx.getStorageSync('userId')
      if(userId){
        this.$http.request({
          method:"post",
          url:"/api/cardForward/add",
          body:{
            "cardId": cartId,


            // "empId":this.empId,
            "forwarderId": this.empId,

            "type": 2,
            "userId":userId
          }
        }).then((data)=>{
          if(data.code==200){
             this.btnStatus=data.data.btnStatus
            //  console.log('已浏览')
          }
        })
      }

    },
      ownInt(){
          this.empId=0

          //this.isSc=true;
          let Authorization1=wx.getStorageSync('Authorization1')
          let cartId1=wx.getStorageSync('cartId1')
          let userId1=wx.getStorageSync('userId1')
          // if(Authorization1){
          //
          //     this.isShare=true;
          //     wx.setStorageSync('Authorization', Authorization1)
          //
          // }else{
          //
          //     this.isShare=false;
          // }
          // if(cartId1){
          //     wx.setStorageSync('cartId', cartId1)
          // }
          // if(userId1){
          //     wx.setStorageSync('userId', userId1)
          //
          // }
        // this.getBanner()
        this.getindexCard( wx.getStorageSync('cartId'), wx.getStorageSync('userId'))
        // this.getNewMaterial()
     //  this.getDetailNose();
      // this.getcardForward();
      },
      getToken(id,options){
          this.$http.request({
              method:"get",
              url:"/api/auth",
              body:{
                  "userId": id
              }
          }).then((data)=>{
              if(data.code==200){
                  wx.setStorageSync('Authorization', data.data.split(' ')[1])


             //  console.log(options)


                if(!options.isCartId){
                  this.getindexCard(options.cartId,'')
                }else{
                  if(options.isCartId==1){
                    this.getindexCard(  "", options.userId)
                  }else if(options.isCartId==2){
                    this.getindexCard(  options.cartId, options.userId)
                  }

                }


                  this.isSc=true;
                  this.isShare=false;
              }
          })
      },
    goCartDetailFun(){//点击卡片回调
        if(!this.empId){
           wx.reLaunch({ url: `/pages/cardDetail/main?id=${this.cardData.id}` })
        }else{
          wx.navigateTo({ url: `/pages/indexDetail/main?id=${this.cardData.id}` })
        }
    },
    getDetailNose(){
      let cartId=wx.getStorageSync('cartId');
      let userId=wx.getStorageSync('userId');
      this.$http.request({
        method:"get",
        url:`/api/promotion/detailByCardId`,
        body:{
          cardId:cartId,
          userId:userId
        }
      }).then((data)=>{
        wx.stopPullDownRefresh()
        if(data.code==200){
          this.id=data.data.id;
          this.message=data.data.description||"感谢您使用销帮电子名片   您的需求永远是我们最大的追求 如有疑问请在客服留言"
        }else{

        }
      })
    },
      scFun(){
          let userInfo = wx.getStorageSync('userInfo')
          let cartId=wx.getStorageSync('cartId1')
          let userId=wx.getStorageSync('userId')
      //  console.log(wx.getStorageSync('cartId'))
               if(userInfo){
                   wx.setStorageSync('isEdit', 0)
                   this.$http.request({
                       method:"post",
                       url:"/api/cardForward/add",
                       body:{
                           "cardLogo":this.options.img,
                           "cardId": cartId,

                           // "empId":this.empId,
                           "forwarderId": this.empId,

                           "type": 3,
                           "userId":userId
                       }
                   }).then((data)=>{
                       if(data.code==200){
                           this.btnStatus=2;
                           wx.showToast({
                               title:'收藏成功' ,
                               icon: 'none',
                               duration:2000

                           })
                       }else{
                           this.scActive=false;
                           wx.showToast({
                               title: '收藏失败',
                               icon: 'success',
                               duration: 2000

                           })
                       }
                   }).catch(()=>{
                       this.scActive=false;
                   })

               }else{
                 this.$refs.getUserinfo.init(this.empId)
               }


      },
    goCartDetail(){
          // this.ownInt();
      let Authorization1=wx.getStorageSync('Authorization1')
      let cartId1=wx.getStorageSync('cartId1')
      let userId1=wx.getStorageSync('userId1')
      // if(Authorization1){
      //   wx.setStorageSync('Authorization', Authorization1)
      //
      // }
      //   // wx.reLaunch({ url: `/pages/indexBox/main` })
      // if(cartId1){
      //   wx.setStorageSync('cartId', cartId1)
      // }
      // if(userId1){
      //   wx.setStorageSync('userId', userId1)
      //
      // }
      // this.getindexCard( wx.getStorageSync('cartId1'), wx.getStorageSync('userId1'))
      wx.reLaunch({ url: `/pages/cardDetail/main?id=${this.cardData.id}` })
        // console.log(this.empId)
        // if(this.empId){
        //     wx.reLaunch({ url: `/pages/cardDetail/main?id=${this.cardData.id}` })
        // }else{
        //     wx.navigateTo({ url: `/pages/indexDetail/main?id=${this.cardData.id}` })
        // }
    },
    changeDomFun(data){//登陆成功后回调
     // this.cartId= wx.getStorageSync('cartId')
      // let userId= wx.getStorageSync('userId')
      // console.log(cartId,userId)
      this.cartId=data.cartId;
     // this.ownInt()
          this.userId=data.userid;
      wx.setStorageSync('isEdit', 0)
      wx.navigateTo({ url: '/pages/createCard/main' })

      // this.getBanner()
      // this.getindexCard(userid)
    },

    getindexCard (cartId,userId) {
      //     let cartId= wx.getStorageSync('cartId')
      // let userId= wx.getStorageSync('userId')
      this.$http.request({
        method: 'get',
        url: `/api/card/detail`,
        body: {
          cardId:cartId||'',
          userId:userId||''
        }
      }).then((data) => {
        if (data.code == 200) {
          // wx.setStorageSync('cartId1', data.data.id)
          //
          // wx.setStorageSync('userId1', data.data.userId)
          this.isOpen=true;
          wx.stopPullDownRefresh()
           if(wx.getStorageSync('userId1')!=wx.getStorageSync('userId')){
             this.getcardForward();
           }else{
           this.btnStatus=1;
           }

          this.getNewMaterial()
          this.isCart = true
          this.cardData = data.data
          let bgId="",objBg={};
          if(this.cardData.flag4){
           bgId=this.cardData.flag4.split('*')[1];
            this.cardData.flag4=this.cardData.flag4.split('*')[0];
            if(bgId){
              objBg=getOptions().filter((item)=>{
                return item.id==bgId;
              })[0];
              if(objBg){
                this.cardData.bgUrl=objBg.url;
               //console.log(this.cardData.bgUrl)
              }
            }else{
               this.cardData.bgUrl="https://img.xbdzmp.com/20200428111831d75990ae5f0b.jpg";
            }

          }else{
              this.cardData.bgUrl="https://img.xbdzmp.com/20200428111831d75990ae5f0b.jpg";
          }
            let obj={};
            obj.logo=data.data.logo;
            obj.name=data.data.name;
            obj.company=data.data.company;
            wx.setStorageSync('shareData', JSON.stringify(obj));
        } else {
          this.cardData = ''
          // wx.showToast({
          //   title: `${data.message}`,
          //   icon: 'none',
          //   duration: 2000
          // })
        }
      })
    },
    // getBanner () {
    //
    //   let cartId = wx.getStorageSync('cartId')
    //   let userId = wx.getStorageSync('userId')
    //   this.$http.request({
    //     method: 'get',
    //     url: '/api/banner/list',
    //     body: {
    //       cardId: cartId,
    //       userId:userId
    //     }
    //   }).then((data) => {
    //     if (data.code == 200) {
    //       wx.stopPullDownRefresh()
    //       this.images = data.data
    //         if(this.images.length){
    //             this.images.forEach((a,i)=>{
    //                 a.isClick=false;
    //                 a.isEdit=false;
    //             })
    //
    //             for(let i=0;i<this.detailListCopy.length;i++){
    //                 this.images.forEach((a,b)=>{
    //                     if(this.detailListCopy[i].defaultImg==a.defaultImg){
    //                         this.detailListCopy[i]=a;
    //                     }
    //                 })
    //             }
    //         }else{
    //             this.detailListCopy=this.detailList.concat([]);
    //         }
    //     }
    //   })
    // },
    getListDetail () {
      let cartId = wx.getStorageSync('cartId')
      this.$http.request({
        method: 'get',
        url: `/api/card/detail/${cartId}`,
        body: {}
      }).then((data) => {
        if (data.code == 200) {
          this.isCart = true
          this.cardData = data.data
        } else {
          wx.showToast({
            title: `${data.message}`,
            icon: 'none',
            duration: 2000
          })
        }
      }).catch((err) => {
        this.isCart = false
      })
    },
    getDetail (id) {
      //  console.log(this.empId)

        let Authorization1=wx.getStorageSync('Authorization')
             if(Authorization1){
               if(!this.empId){
                 wx.reLaunch({ url: `/pages/cardDetail/main?id=${this.cardData.id}&empId=${this.empId}` })
               }else{
                 wx.navigateTo({ url: `/pages/indexDetail/main?id=${this.cardData.id}&empId=${this.empId}&btnStatus=${this.btnStatus}` })
               }
             }




    },

    createCard () {
      let userInfo = wx.getStorageSync('userInfo')
      if(userInfo){
        wx.setStorageSync('isEdit', 0)
        wx.navigateTo({ url: '/pages/createCard/main' })
      }else{
        this.$refs.getUserinfo.init(this.empId,1)
      }

    },
    // goDetail () {
    //   console.log(1)
    //   wx.reLaunch({ url: `/pages/cardDetail/main?id=${this.cartId1}` })
    // },
    onDragSortChange (e) {
    //  console.log(e)
      // frontData 插到谁后面
      // data 操作的数据
    }
  },

  created () {
    // let app = getApp()
  }
}
</script>
<style>
  ._van-notice-bar{
    font-size: 28rpx;
  }
  .van-notice-bar__wrap{
    font-size: 37rpx;
  }
</style>
<style  scoped>
  .list_content{
    width: 85%;

  }
  .content_top{
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .content_midd_title{
    font-size: 28rpx;
    width: 100%;
    color:#000;
    margin-top: 10rpx;
    /*display: -webkit-box;*/
    /*overflow: hidden;*/
    /*text-overflow: ellipsis;*/
    word-wrap: break-word;
    /*white-space: normal !important;*/
    /*-webkit-line-clamp: 2;*/
    /*-webkit-box-orient: vertical;*/

  }
  .fontStyle{
    font-family: 'KaiTi';
    text-indent:40rpx;
  }
  .content_midd_title{
    font-size: 28rpx;
    width: 100%;
    color:#000;
    /*display: -webkit-box;*/
    /*overflow: hidden;*/
    /*text-overflow: ellipsis;*/
    word-wrap: break-word;
    /*white-space: normal !important;*/
    /*-webkit-line-clamp: 2;*/
    /*-webkit-box-orient: vertical;*/

  }
  .listBox{
    width: 100%;
    background: #fff;
    margin-bottom: 20rpx;
    box-sizing: border-box;
    padding:10rpx 20rpx;
    display: flex;
    justify-content: space-between;
  }
  .listBox>img{
    width: 100rpx;
    height: 100rpx;
    border-radius: 50%;

  }
 .title{
    text-align: left;
    box-sizing: border-box;
    padding-left: 40rpx;
    position: relative;
    margin-bottom: 40rpx;
  }
  .title:before{
    content:"" ;
    width: 10rpx;
    height: 20px;
    background: #10AEFF;
    position: absolute;
    top:7rpx;
    left:17rpx;
  }
  .conpanyDetail{
    background: #fff;
    width: 100%;
    margin-top:40rpx;
    box-sizing: border-box;
    padding:10rpx;
  }
  .cartPosition{
    width: 100%;
    /*position: absolute;*/
    /*top:12rpx;*/
    /*left:0;*/
    z-index: 1000;
  }
  .bannerTitle{
    width: 100%;
    text-align: center;
    overflow: hidden;
    margin-bottom:20rpx;
    text-overflow: ellipsis;
  }
  .bannerBox{
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
  }
  /*.bannerBox img{*/
  /*  width: 80%;*/
  /*  height: 400rpx;*/
  /*}*/
  .cartBox{
    width: 90%;
    height:400rpx ;
    color: #fff;
    /*background-color: #;*/
    overflow: hidden;
    transition: all 0.5s;
    margin:0 auto;
    position: relative;
    border-radius: 10px;
    box-shadow: 5px 5px 5px #999;
    border: 1px solid #000;
    /*border: 5px solid rgb(61,176,243);*/
    /*border-bottom: 5px solid rgb(61,176,243);*/
    box-sizing: border-box;
    padding:25rpx;
    /*background:#f7f7f7 url("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1577982769895&di=2b65bd6b72e73c15f936d4ddfedaaccf&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F03%2F52%2F00%2F6357931b6ead28e.jpg") no-repeat;*/
    background:#f7f7f7 url("https://img.xbdzmp.com/20200428111831d75990ae5f0b.jpg") no-repeat;
    background-size: auto;
  }
  .cartBox .weui-uploader__file_status:before{
    background-color:transparent ;
  }
  .cartBox.active ._van-icon{
    top:537rpx;
  }
  .cartBox .weui-uploader__file{
    width:  150rpx;
    height: 150rpx;
    border-radius: 20rpx;
    margin-top:5rpx;
    /*background:url() no-repeat;*/
    /*background: url("../../../static/images/header.png") no-repeat;*/
  }
  .cartBox ._van-icon{
    width: 20px;
    height: 20px;
    position:absolute;
    top:337rpx;
    right:48%;
  }
  .cartBox .more{
    text-align: right;
    position: absolute;
    right: 30rpx;
    bottom:13rpx;
    font-size: 28rpx;
  }
  .cartBox .weui-uploader__file_status:before{
    background-color:transparent ;
  }
  .cart_name>p:first-child{
    margin-bottom: 30rpx;
    font-size: 45rpx;
  }
  .cartBox .weui-uploader__file{
    width:  150rpx;
    height: 150rpx;
    border-radius: 20rpx;
    margin-top:5rpx;
  }
  .banner{
    height: 500rpx;
    width: 100%;
    margin-top:400rpx;
    margin-bottom: 25rpx;
  }
  .banner>.swiper{
    height:500rpx;
    background-color: #fff;
  }
  .product{
    width: 100%;
    box-sizing: border-box;
    padding:20rpx;
    font-size: 28rpx;
    background-color: #fff;
  }
  .banner ._swiper{
    padding:20rpx 0;
  }
 .banner ._swiper-item{
       display: flex;
       justify-content: center;
       align-items: center;
  }
  .product>.product_list{
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
  }
  .product>.product_list>li{
    width:45%;
    box-sizing: border-box;
    border-radius: 20rpx;
    /*box-shadow: 5px 5px 5px rgb(251,251,251);*/
    /* margin-bottom: 20rpx; */
  }
  .product>.product_list>li>p{
    text-align:  center;
  }
  .product>.product_list>li>div>img{

    max-width: 100%;
    height:450rpx;

  }
  .product>.product_list>li>div{
    position: relative;
    border:1px solid #ddd;
    max-width: 100%;
    height:450rpx;
  }
  .product>.product_list>li>div>div{
    position: absolute;
    bottom:0;
    left:0;
    right: 0;
    height:60rpx;
    background-color: rgba(0,0,0,.5);
    font-size: 28rpx;
    color: #fff;
    text-align: left;
    box-sizing: border-box;
    padding-left: 10rpx;
    line-height: 60rpx;
  }
/*  .banner img {
    width: 100%;
    display: block;
  } */
    .page{
      width: 100%;
      height: 100% ;
      background: #fff;
      box-sizing: border-box;
      font-size: 28rpx;
      padding:20rpx 0;
    }

    .cart_bt p:first-child{
      font-size: 50rpx;
       color:rgb(114,114,114)
    }
    .cart_bt p:last-child{
      color:rgb(131,131,133)
    }
    .createShare{
      width: 45%;
      height: 100%;
      background: #3cc51f;
      margin-left: 25rpx;
      color: #fff;
      line-height: 80rpx;
    }
    .createOut{
     width: 100%;
     height:80rpx ;
     margin-top:40rpx;
     /* position: fixed;
     right:5% ;
     bottom:3%; */
     /*background: rgb(63,176,244);*/
     transition: all 1s;
     border-radius: 20px;
     color: #fff;
     display: flex;
     justify-content: center;
     align-items: center;
     flex-wrap: nowrap;
     box-sizing: border-box;
     padding-right:20rpx;
     font-size: 36rpx;
     text-align: center;
    }
    .create{
     background: #fff;
     border:1px solid #3cc51f;
     width: 45%;
     height: 100%;
     text-align: center;
     border-radius: 5px;
     color: #3cc51f;
     line-height: 80rpx;
     box-sizing: border-box;
     padding-right:20rpx;
     font-size: 32rpx;
     text-align: center;
      /*padding-left: 20rpx;*/
    }
  /*.fz{*/
  /*  width: 100%;*/
  /*  position: absolute;*/
  /*  bottom:15%;*/
  /*  left:0;*/
  /*  color: #333333;*/
  /*}*/
    .create>span{
      white-space: nowrap;
      overflow: hidden;
      margin:0 auto;
    }
    .create.active{
      width: 90%;
      transition: all 1s;
    }

    .samll{
      width: 80rpx;
      height:80rpx;
      position: absolute;
      top:0;
      right: 10rpx;
      border-radius: 50%;
      text-align: center;
      line-height:80rpx;
    }
    .samll img{
      width:64rpx;
      height: 64rpx;
      margin-left: 10rpx;
      margin-right: 10rpx;
    }
    .cart_top{
     /* margin:20rpx; */
     display: flex;
     justify-content: space-between;
     margin-bottom: 50rpx;
    }
    .cart_top p:first-child{
      color: rgb(170,169,175);
    }
    .cart_top img{
      width: 100rpx;
      height: 100rpx;
      border-radius: 50%;
    }
    .box{
      width: 74rpx;
      height:120rpx;
      background-color: rgba(255,255,255,.5);
      border:1px solid rgb(61,176,243);
      /* border: 1px solid rgb(61,176,243); */
      border-radius: 30rpx;
      position: fixed;
      bottom:8%;
      right: 5%;
      font-size: 22rpx;
      /*display: flex;*/
      /*justify-content: center;*/
      /*align-content: center;*/
      /*flex-wrap: wrap;*/

      text-align: center;
      transform :translateY(-60rpx);
    }
    .box>li{
      width: 100%;
      height:57%;
      margin-top:22%;
    }

    #share{
      width: 100%;
      height: 100%;
        background-color: transparent;
      border:none;
      padding-left: 0;
      padding-right: 0;
      line-height: 80rpx;
      font-size: 30rpx;
      display: initial;
      color: #fff;
       box-sizing: border-box;
      padding:10rpx 0;
    }
    #share:after{
      border:none;
    }
    .box>li:first-child{
      /*margin-bottom: 10rpx;*/
    }
    .box img{
      width: 40rpx;
      height: 40rpx;
      /*margin-top:26rpx;*/
    }
</style>
